#include "stdafx.h"
#include "CreateItemPanel.h"
#include "EditItemPanel.h"

#ifdef WIN32
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif //_DEBUG
#endif //WIND32

namespace serika
{
	namespace dq
	{
		CreateItemPanel::CreateItemPanel(int itemType, EditItemPanel* panel, CTabCtrl* parent)
			: mWnd(panel)
			, mParent(parent)
			, mItemType(itemType)
		{
		}

		CreateItemPanel::~CreateItemPanel()
		{
			//if (mWnd)
			//{
			//	mWnd->DestroyWindow();
			//	delete mWnd;
			//}
		}

		void CreateItemPanel::Activate()
		{
			//if (!mWnd)
			//{
			//	mWnd = new EditItemPanel(mItemType, mParent);
			//	mWnd->Create(mParent);
			//}
			CRect rect;
			mParent->GetClientRect(&rect);
			RECT itemRect;
			mParent->GetItemRect(0, &itemRect);
			rect.top = itemRect.bottom;
			mWnd->MoveWindow(&rect);
			mWnd->OnActivate();
			mWnd->SetItemType(mItemType);
		}

		void CreateItemPanel::Deactivate()
		{
			mWnd->OnDeactivate();
		}
	}
}
